﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BUS;
using DTO;

namespace MasterPageGroupF3.AdminPages
{
    public partial class WebForm6 : System.Web.UI.Page
    {
        private Object list;
        private Object listRevenueByProvider;
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = "Thống kê";

            list = PRODUCTBUS.DoanhThuTheoSanPham();
            listRevenueByProvider = PROVIDERBUS.DoanhThuTheoNhaCungCap();
            if (!IsPostBack)
            {
                GridView1.DataSource = list;
                GridView1.DataBind();
                Provider.DataSource = listRevenueByProvider;
                Provider.DataBind();
            }
        }

        protected void btsearch_Click(object sender, EventArgs e)
        {

        }

        protected void Provider_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            Provider.PageIndex = e.NewPageIndex;
            Provider.DataSource = listRevenueByProvider;
            Provider.DataBind();
        }

        protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            GridView1.PageIndex = e.NewPageIndex;
            GridView1.DataSource = list;
            GridView1.DataBind();
        }

        protected void Button1_Click(object sender, EventArgs e)
        {            
            int month,year;
            month = Int32.Parse(months.SelectedValue.ToString());
            year = Int32.Parse(DropDownListYear.SelectedValue.ToString());

            GridView2.DataSource = PROVIDERBUS.DoanhThuTrongThang(month, year);
            GridView2.DataBind();
        }


       
    }
}